
<h1><span class="yiyi-st" id="yiyi-12">numpy.log1p</span></h1>
        <blockquote>
        <p>原文：<a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.log1p.html">https://docs.scipy.org/doc/numpy/reference/generated/numpy.log1p.html</a></p>
        <p>译者：<a href="https://github.com/wizardforcel">飞龙</a> <a href="http://usyiyi.cn/">UsyiyiCN</a></p>
        <p>校对：（虚位以待）</p>
        </blockquote>
    
<dl class="data">
<dt id="numpy.log1p"><span class="yiyi-st" id="yiyi-13"> <code class="descclassname">numpy.</code><code class="descname">log1p</code><span class="sig-paren">(</span><em>x</em><span class="optional">[</span>, <em>out</em><span class="optional">]</span><span class="sig-paren">)</span><em class="property"> = &lt;ufunc &apos;log1p&apos;&gt;</em></span></dt>
<dd><p><span class="yiyi-st" id="yiyi-14">返回一个加自然对数的输入数组，元素。</span></p>
<p><span class="yiyi-st" id="yiyi-15">Calculates <code class="docutils literal"><span class="pre">log(1</span> <span class="pre">+</span> <span class="pre">x)</span></code>.</span></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name">
<col class="field-body">
<tbody valign="top">
<tr class="field-odd field"><th class="field-name"><span class="yiyi-st" id="yiyi-16">参数：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-17"><strong>x</strong>：array_like</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-18">输入值。</span></p>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name"><span class="yiyi-st" id="yiyi-19">返回：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-20"><strong>y</strong>：ndarray</span></p>
<blockquote class="last">
<div><p><span class="yiyi-st" id="yiyi-21"><em class="xref py py-obj">1 + x</em>的自然对数，逐元素。</span></p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<div class="admonition seealso">
<p class="first admonition-title"><span class="yiyi-st" id="yiyi-22">也可以看看</span></p>
<dl class="last docutils">
<dt><span class="yiyi-st" id="yiyi-23"><a class="reference internal" href="numpy.expm1.html#numpy.expm1" title="numpy.expm1"><code class="xref py py-obj docutils literal"><span class="pre">expm1</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-24"><code class="docutils literal"><span class="pre">exp(x)</span> <span class="pre">-</span> <span class="pre">1</span></code>, the inverse of <a class="reference internal" href="#numpy.log1p" title="numpy.log1p"><code class="xref py py-obj docutils literal"><span class="pre">log1p</span></code></a>.</span></dd>
</dl>
</div>
<p class="rubric"><span class="yiyi-st" id="yiyi-25">笔记</span></p>
<p><span class="yiyi-st" id="yiyi-26">对于实值输入，<a class="reference internal" href="#numpy.log1p" title="numpy.log1p"><code class="xref py py-obj docutils literal"><span class="pre">log1p</span></code></a>对于小于在浮点精度中<em class="xref py py-obj">1 + x == 1</em>的<em class="xref py py-obj">x</em>也是准确的。</span></p>
<p><span class="yiyi-st" id="yiyi-27">对数是多值函数：对于每个<em class="xref py py-obj">x</em>，存在无穷多的<em class="xref py py-obj">z</em>，使得<em class="xref py py-obj">exp（z）= 1 + x</em>。</span><span class="yiyi-st" id="yiyi-28">约定是返回其虚部在<em class="xref py py-obj">[ -  pi，pi]</em>中的<em class="xref py py-obj">z</em>。</span></p>
<p><span class="yiyi-st" id="yiyi-29">对于实值输入数据类型，<a class="reference internal" href="#numpy.log1p" title="numpy.log1p"><code class="xref py py-obj docutils literal"><span class="pre">log1p</span></code></a>始终返回实际输出。</span><span class="yiyi-st" id="yiyi-30">对于不能表示为实数或无穷大的每个值，它会产生<code class="docutils literal"><span class="pre">nan</span></code>并设置<em class="xref py py-obj">无效</em>浮点错误标志。</span></p>
<p><span class="yiyi-st" id="yiyi-31">对于复值输入，<a class="reference internal" href="#numpy.log1p" title="numpy.log1p"><code class="xref py py-obj docutils literal"><span class="pre">log1p</span></code></a>是具有分支切口<em class="xref py py-obj">[ -  inf，-1]</em>的复杂分析函数，并且从上面是连续的。</span><span class="yiyi-st" id="yiyi-32"><a class="reference internal" href="#numpy.log1p" title="numpy.log1p"><code class="xref py py-obj docutils literal"><span class="pre">log1p</span></code></a>将浮点负零作为无穷小负数处理，符合C99标准。</span></p>
<p class="rubric"><span class="yiyi-st" id="yiyi-33">参考文献</span></p>
<table class="docutils citation" frame="void" id="r48" rules="none">
<colgroup><col class="label"><col></colgroup>
<tbody valign="top">
<tr><td class="label"><span class="yiyi-st" id="yiyi-34"><a class="fn-backref" href="#id1">[R48]</a></span></td><td><span class="yiyi-st" id="yiyi-35">Abramowitz和I.A.</span><span class="yiyi-st" id="yiyi-36">Stegun，“Handbook of Mathematical Functions”，10th printing，1964，pp。</span><span class="yiyi-st" id="yiyi-37">67. <a class="reference external" href="http://www.math.sfu.ca/~cbm/aands/">http://www.math.sfu.ca/~cbm/aands/</a></span></td></tr>
</tbody>
</table>
<table class="docutils citation" frame="void" id="r49" rules="none">
<colgroup><col class="label"><col></colgroup>
<tbody valign="top">
<tr><td class="label"><span class="yiyi-st" id="yiyi-38"><a class="fn-backref" href="#id2">[R49]</a></span></td><td><span class="yiyi-st" id="yiyi-39">维基百科，“对数”。</span><span class="yiyi-st" id="yiyi-40"><a class="reference external" href="http://en.wikipedia.org/wiki/Logarithm">http://en.wikipedia.org/wiki/Logarithm</a></span></td></tr>
</tbody>
</table>
<p class="rubric"><span class="yiyi-st" id="yiyi-41">例子</span></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">log1p</span><span class="p">(</span><span class="mi">1</span><span class="n">e</span><span class="o">-</span><span class="mi">99</span><span class="p">)</span>
<span class="go">1e-99</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">log</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="mi">1</span><span class="n">e</span><span class="o">-</span><span class="mi">99</span><span class="p">)</span>
<span class="go">0.0</span>
</pre></div>
</div>
</dd></dl>
